<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class HistoryDatum
 * 
 * @property int $id
 * @property int|null $branch_id
 * @property int|null $worker_id
 * @property string|null $day_size
 * @property string|null $day_rate
 * @property string|null $day_new_size
 * @property string|null $day_new_rate
 * @property string|null $day_stock_size
 * @property string|null $day_stock_rate
 * @property string|null $day_turn_size
 * @property string|null $day_turn_rate
 * @property string|null $week_size
 * @property string|null $week_rate
 * @property string|null $week_new_size
 * @property string|null $week_new_rate
 * @property string|null $week_stock_size
 * @property string|null $week_stock_rate
 * @property string|null $week_turn_size
 * @property string|null $week_turn_rate
 * @property string|null $month_size
 * @property string|null $month_rate
 * @property string|null $month_new_size
 * @property string|null $month_new_rate
 * @property string|null $month_stock_size
 * @property string|null $month_stock_rate
 * @property string|null $month_turn_size
 * @property string|null $month_turn_rate
 * @property string|null $top_half_year_size
 * @property string|null $top_half_year_rate
 * @property string|null $top_half_year_new_size
 * @property string|null $top_half_year_new_rate
 * @property string|null $top_half_year_stock_size
 * @property string|null $top_half_year_stock_rate
 * @property string|null $top_half_year_turn_size
 * @property string|null $top_half_year_turn_rate
 * @property string|null $bottom_half_year_size
 * @property string|null $bottom_half_year_rate
 * @property string|null $bottom_half_year_new_size
 * @property string|null $bottom_half_year_new_rate
 * @property string|null $bottom_half_year_stock_size
 * @property string|null $bottom_half_year_stock_rate
 * @property string|null $bottom_half_year_turn_size
 * @property string|null $bottom_half_year_turn_rate
 * @property string|null $year_size
 * @property string|null $year_rate
 * @property string|null $year_new_size
 * @property string|null $year_new_rate
 * @property string|null $year_stock_size
 * @property string|null $year_stock_rate
 * @property string|null $year_turn_size
 * @property string|null $year_turn_rate
 * @property string|null $day
 * @property string|null $week
 * @property string|null $month
 * @property string|null $year
 * @property string|null $month_day
 * @property string|null $day_of_year
 * @property Carbon|null $create_time
 * @property Carbon|null $update_time
 * 
 * @property Branch|null $branch
 * @property Worker|null $worker
 *
 * @package App\Models
 */
class HistoryDatum extends Model
{
    protected $table = 'history_datum';

    protected $casts = [
        'branch_id' => 'int',
        'worker_id' => 'int'
    ];

    protected $fillable = [
        'branch_id',
        'worker_id',
        'day_size',
        'day_rate',
        'day_new_size',
        'day_new_rate',
        'day_stock_size',
        'day_stock_rate',
        'day_turn_size',
        'day_turn_rate',
        'week_size',
        'week_rate',
        'week_new_size',
        'week_new_rate',
        'week_stock_size',
        'week_stock_rate',
        'week_turn_size',
        'week_turn_rate',
        'month_size',
        'month_rate',
        'month_new_size',
        'month_new_rate',
        'month_stock_size',
        'month_stock_rate',
        'month_turn_size',
        'month_turn_rate',
        'top_half_year_size',
        'top_half_year_rate',
        'top_half_year_new_size',
        'top_half_year_new_rate',
        'top_half_year_stock_size',
        'top_half_year_stock_rate',
        'top_half_year_turn_size',
        'top_half_year_turn_rate',
        'bottom_half_year_size',
        'bottom_half_year_rate',
        'bottom_half_year_new_size',
        'bottom_half_year_new_rate',
        'bottom_half_year_stock_size',
        'bottom_half_year_stock_rate',
        'bottom_half_year_turn_size',
        'bottom_half_year_turn_rate',
        'year_size',
        'year_rate',
        'year_new_size',
        'year_new_rate',
        'year_stock_size',
        'year_stock_rate',
        'year_turn_size',
        'year_turn_rate',
        'day',
        'week',
        'month',
        'year',
        'month_day',
        'day_of_year'
    ];

    public function branch()
    {
        return $this->belongsTo(Branch::class);
    }

    public function worker()
    {
        return $this->belongsTo(Worker::class);
    }
}
